//
//      CGE - CRAb Graphics Engine
// 
//      Copyright (C) 2003-2009 by CRAb-UFC
//
//		This file is part of the "CRAb Graphics Engine"
//		See the copyright notice in cge.h for conditions of distribution and use.
//

#ifndef CGE_SOCKETUTILS_CLASS_H__
#define CGE_SOCKETUTILS_CLASS_H__

#include "cgeInetAddress.h"

namespace basterd
{
	namespace net
	{
		/** @brief Encapsulates a bunch of socket utility methods.
		 *
		 *  @remarks
		 *      Basically this class abstracts the access many common options that all
		 * sockets share in their basic API:
		 *    - SO linger;
		 *    - blocking and non-blocking read/write;
		 *    - keep alive;
		 *    - reuse address or port;
		 *    - broadcasting;
		 *    - time to live;
		 *    - etc, etc.
		 */
		class CGE_API SocketUtils
		{
		public:

			/**
			 *  The SO_KEEPALIVE parameter is a socket option 
			 *  that makes the socket send keepalive messages
			 *  on the session.
			 */
			static bool setKeepAlive( __socket sid, bool enabled = true );
			static bool getKeepAlive( __socket sid );

			static bool setBroadcast( __socket sid, bool enabled = true );
			static bool getBroadcast( __socket sid );

			static bool setReuseAddress( __socket sid, bool enabled = true );
			static bool getReuseAddress( __socket sid );


			static bool setNonBlocking( __socket sid, bool enabled = true );
			static bool getNonBlocking( __socket sid );

				// TODO: adicionar um m�todo para manipular cada um dos par�metros.	

		}; // end of the Socket class
	}
}



#endif // CGE_SOCKETUTILS_CLASS_H__
